﻿using DotNetNuke.Common.Utilities;

namespace BrandonHaynes.ModelAdapter.EntityFramework
	{
	/// <summary>
	/// Adapts an Entity Framework model to target a DotNetNuke installation, invariant of the deployment 
	/// environment's ObjectQualifier and DatabaseOwner
	/// </summary>
	public class DotNetNukeModelAdapter : BaseDecoratorModelAdapter
		{
		public DotNetNukeModelAdapter()
			// Adapt the model by creating a table prefix adapter (which adds the ObjectQualifier) and
			// a schema adapter (which changes the DatabaseOwner)
			: base(new TablePrefixModelAdapter(Config.GetObjectQualifer(), new TableSchemaModelAdapter(Config.GetDataBaseOwner().TrimEnd('.'))))
			{ }
		}
	}
